#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

# -*- mode: python; -*-

import platform
if platform.system() == 'Darwin':
    Return()

import re
Import('AgentEnv')
env = AgentEnv.Clone()

# test specific modifications
AgentEnv.MakeTestEnv(env)

targets = env.IFMapAutogen('test_cfg.xsd')
lib_srcs = [x for x in targets if re.match(r'(.*)\.cc$', x.abspath)]
env.Library('ifmap_test', lib_srcs)
env.Library('control_node_mock', 'control_node_mock.cc');
env.Library('agent_test_buildinfo', 'test_buildinfo.cc')

env.Append(LIBPATH = [
        '../../../db/test',
])

env.Append(LIBS = [
        'dbtest',
        'task_test',
        ])


if platform.system() == 'FreeBSD':
    platform_dependent = 'freebsd/test_util_tap.cc'
elif platform.system() == 'Linux':
    platform_dependent = 'linux/test_util_tap.cc'
elif platform.system() == 'Windows':
    platform_dependent ='windows/test_util_tap.cc'

test_lib_srcs = ['test_agent_init.cc',
                 'test_init.cc',
                 'test_util.cc',
                 platform_dependent,
                 '../pkt/test/test_pkt_util.cc',
                 '../vrouter/ksync/test/ksync_test.cc',
                 '../uve/test/agent_param_test.cc',
                 '../uve/test/agent_uve_test.cc',
                 '../uve/test/agent_stats_collector_test.cc',
                 '../uve/test/interface_uve_table_test.cc',
                 '../uve/test/prouter_uve_table_test.cc',
                 '../uve/test/vm_uve_table_test.cc',
                 '../uve/test/vn_uve_table_test.cc',
                 '../uve/test/vrouter_uve_entry_test.cc']
env.Library('agent_test', test_lib_srcs)

agent_suite = []
flaky_agent_suite = []

test_vn = AgentEnv.MakeTestCmd(env, 'test_vn', agent_suite)
test_vm = AgentEnv.MakeTestCmd(env, 'test_vm', agent_suite)
test_ksync = AgentEnv.MakeTestCmd(env, 'test_ksync', agent_suite)
test_vmport_cfg = AgentEnv.MakeTestCmd(env, 'test_vmport_cfg', agent_suite)
test_alias_ip_cfg = AgentEnv.MakeTestCmd(env, 'test_alias_ip_cfg', agent_suite)
test_evpn_route = AgentEnv.MakeTestCmd(env, 'test_evpn_route', agent_suite)
test_forwarding_mode = AgentEnv.MakeTestCmd(env, 'test_forwarding_mode', agent_suite)
test_route = AgentEnv.MakeTestCmd(env, 'test_route', agent_suite)
test_l2route = AgentEnv.MakeTestCmd(env, 'test_l2route', agent_suite)
test_cfg = AgentEnv.MakeTestCmd(env, 'test_cfg', agent_suite)
test_path_preference_walker =AgentEnv.MakeTestCmd(env,
                                                  'test_path_preference_walker',
                                                  agent_suite)
test_tsn_route = AgentEnv.MakeTestCmd(env, 'test_tsn_route', agent_suite)
test_ecmp6 = AgentEnv.MakeTestCmd(env, 'test_ecmp6', agent_suite)
test_dpdk_mpls = AgentEnv.MakeTestCmd(env, 'test_dpdk_mpls', agent_suite)
test_bgp_service_configuration = AgentEnv.MakeTestCmd(env,
                                                      'test_bgp_service_configuration',
                                                      agent_suite)
test_bgp_router_config = AgentEnv.MakeTestCmd(env,
                                              'test_bgp_router_config',
                                              agent_suite)
test_agent_db_entry = AgentEnv.MakeTestCmd(env, 'test_agent_db_entry',
                                           agent_suite)
test_llgr = AgentEnv.MakeTestCmd(env, 'test_llgr', agent_suite)
test_event_notifier = AgentEnv.MakeTestCmd(env, 'test_event_notifier',
                                           agent_suite)
test_integration = AgentEnv.MakeTestCmd(env, 'test_integration', agent_suite)
test_vhost_ip_change = AgentEnv.MakeTestCmd(env, 'test_vhost_ip_change',
                                            agent_suite)
test_nh = AgentEnv.MakeTestCmd(env, 'test_nh', agent_suite)
test_ecmp_nh = AgentEnv.MakeTestCmd(env, 'test_ecmp_nh', agent_suite)
test_ecmp_l2 = AgentEnv.MakeTestCmd(env, 'test_ecmp_l2', agent_suite)
test_global_vrouter_config = AgentEnv.MakeTestCmd(env,
                                                 'test_global_vrouter_config',
                                                  agent_suite)
test_agent_route_walker = AgentEnv.MakeTestCmd(env, 'test_agent_route_walker',
                                               agent_suite)

test_vrf = AgentEnv.MakeTestCmd(env, 'test_vrf', flaky_agent_suite)
test_tunnel_encap = AgentEnv.MakeTestCmd(env, 'test_tunnel_encap',
                                         flaky_agent_suite)

test_peer_del = AgentEnv.MakeTestCmd(env, 'test_peer_del', flaky_agent_suite)
test_mirror = AgentEnv.MakeTestCmd(env, 'test_mirror', flaky_agent_suite)
test_dummy = AgentEnv.MakeTestCmd(env, 'test_dummy', flaky_agent_suite)
test_multicast = AgentEnv.MakeTestCmd(env, 'test_multicast', flaky_agent_suite)
test_service_chain_cfg = AgentEnv.MakeTestCmd(env, 'test_service_chain_cfg',
                                              agent_suite)
test_route_mock = AgentEnv.MakeTestCmd(env, 'test_route_mock',
                                       flaky_agent_suite)
test_scale_walk = AgentEnv.MakeTestCmd(env, 'test_scale_walk',
                                       flaky_agent_suite)
service_instance_test = AgentEnv.MakeTestCmd(env, 'service_instance_test',
                                             flaky_agent_suite)
test_vxlan_routing = AgentEnv.MakeTestCmd(env, 'test_vxlan_routing', agent_suite)

test_xmpp_hv2 = AgentEnv.MakeTestCmd(env, 'test_xmpp_hv2', flaky_agent_suite)
test_xmpp_non_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_non_hv', flaky_agent_suite)
test_xmppcs_hv = AgentEnv.MakeTestCmd(env, 'test_xmppcs_hv', flaky_agent_suite)
test_xmppcs_non_hv = AgentEnv.MakeTestCmd(env, 'test_xmppcs_non_hv',
                                           flaky_agent_suite)

test_xmpp_v6_non_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_v6_non_hv',
                                           flaky_agent_suite)
test_xmpp_v6_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_v6_hv', 
                                       flaky_agent_suite)

test_xmpp_ifmap = AgentEnv.MakeTestCmd(env, 'test_xmpp_ifmap', flaky_agent_suite)
test_xmppcs_ifmap = AgentEnv.MakeTestCmd(env, 'test_xmppcs_ifmap', flaky_agent_suite)
test_xmpp_bcast_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_bcast_hv',
                                          flaky_agent_suite)
test_xmpp_bcast_non_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_bcast_non_hv',
                                              flaky_agent_suite)
test_xmppcs_bcast_hv = AgentEnv.MakeTestCmd(env, 'test_xmppcs_bcast_hv',
                                            flaky_agent_suite)
test_xmppcs_bcast_non_hv = AgentEnv.MakeTestCmd(env,'test_xmppcs_bcast_non_hv',
                                                flaky_agent_suite)
test_xmpp_hv = AgentEnv.MakeTestCmd(env, 'test_xmpp_hv', flaky_agent_suite)

flaky_test = env.TestSuite('agent-flaky-test', flaky_agent_suite)
env.Alias('controller/src/vnsw/agent:flaky_test', flaky_test)

env.Prepend(LIBS = [ 'dbtest', 'task_test' ])
env.Prepend(LIBPATH = [ '../../../db/test'])
test = env.TestSuite('agent-test', agent_suite)
env.Alias('agent:agent_test', test)
env.Alias('controller/src/vnsw/agent:test', test)
Return('agent_suite')

# Local Variables:
# mode: python
# End:
